/**
 * @EasyActor.as
 *
 * @author sodaChen mail:asframe@qq.com
 * @version 1.0
 * <br>Copyright (C), 2016 asFrame.com
 * <br>This program is protected by copyright laws.
 * <br>Program Name:ASFrame
 * <br>Date:2016-6-29
 */
package com.asframe.action
{
	import com.asframe.utils.VectorUtils;

	/**
	 * 简单的表演者，不具备队列和排斥的作用，所有的action都会立刻进行使用，相当于全部都是并发
	 * @author sodaChen
	 * Date:2016-6-29
	 */
	public class EasyActor implements IActor
	{
		/** action的列表 **/
		protected var mActionList:Vector.<IAction>;

		public function EasyActor()
		{
			mActionList=new Vector.<IAction>();
		}

		public function act(action:IAction, callBack:Function=null, param:* =null):Boolean
		{
			mActionList.push(action);
			if (callBack != null || param != null)
			{
				action.initAction(callBack, param);
			}
			action.start(this);
			return true;
		}

		public function delAction(action:*,isDestory:Boolean = false):void
		{
			VectorUtils.removeItem(mActionList, action);
			if(isDestory)
				action.destroy();
		}
	}
}
